#include "util/logger/Logger.h"

namespace util {

Logger::Logger() {

}

Logger::~Logger() {

}

std::string Logger::buildMessage(std::string message, std::string type) {
	std::string line("[");
	line.append(this->getCurrentTime());
	line.append("] ");
	line.append(type);
	line.append(" - ");
	line.append(message);
	line.append("\n");
	return line;
}

std::string Logger::getCurrentTime() {
	// Armo la fecha.
	time_t rawtime;
	struct tm * timeinfo;
	time(&rawtime);
	timeinfo = localtime(&rawtime);
	// Armo el string resultado.
	char aux[26];
	size_t size(26);
	// "%Y %a %b %d %X" es formato para: 2001 Thu Aug 23 14:55:02
	strftime(aux, size, "%Y %a %b %d %X", timeinfo);
	std::string ret(aux);
	return ret;
}

}
